#pragma once

#include <pthread.h>
#include <arpa/inet.h>

typedef struct user_info {
    int sockfd;
    char player_mode;
    struct sockaddr_in opponent_address;
    uint8_t connection_expect;

    pthread_mutex_t lock;
}UserInfo;

UserInfo *UserInfoHandler_NewUserInfo(int sockfd, char player_mode, uint8_t default_connect_expect);

void UserInfoHandler_DestoryUserInfo(UserInfo *user_info);

void UserInfoHandler_SetOpponentAddress(UserInfo *user_info, struct sockaddr_in opponent_address);

void UserInfoHandler_SetConnectionExpect(UserInfo *user_info, uint8_t connection_expect);

void UserInfoHandler_SetPlayerMode(UserInfo *user_info, char player_mode);

struct sockaddr_in UserInfoHandler_GetOpponentAddress(UserInfo *user_info);

uint8_t UserInfoHandler_GetConnectionExpect(UserInfo *user_info);

char UserInfoHandler_GetPlayerMode(UserInfo *user_info);